import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserIndex.vue')
        },
        {
            path: '/u_pay_for_order',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/PayForOrder.vue')
        },
        {
            path: '/u_cart',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/Cart.vue')
        },
        {
            path: '/u_person',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserPerson.vue'),meta: {requireAuth: true}
        },
        {
            path: '/u_login',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserLogin.vue')
        },
        {
            path: '/u_movie',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserCake.vue')
        },
        {
            path: '/u_book',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserDessert.vue')
        },
        {
            path: '/u_music',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserPudding.vue')
        },
        {
            path: '/u_pic',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/picture.vue'),

        },
        {
            path: '/u_form',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserForm.vue'),
            meta: {requireAuth: true}
        },
        {
            path: '/u_movies',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserCakes.vue'),meta: {requireAuth: true}
        },
        {
            path: '/u_books',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserDesserts.vue'),
            meta: {requireAuth: true}
        },
        {
            path: '/u_musics',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserPuddings.vue'),meta: {requireAuth: true}
        },
        {
            path: '/u_regist',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/UserRegister.vue')
        },
        {
            path: '/u_login_index',
            component: () => import(/* webpackChunkName: "home" */ '../components/User/LoginUserIndex.vue'),meta: {requireAuth: true}
        },
        {
            path: '/admin',
            component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
            meta: { title: '自述文件' },
            children: [
                {
                    path: '/dashboard',
                    component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'),
                    meta: { title: '管理首页' ,requireAuth: true}
                },
                {
                    path: '/person_table',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/PersonTable.vue'),
                    meta: { title: '用户表格' ,requireAuth: true}
                },
                {
                    path: '/book_table',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/DessertTable.vue'),
                    meta: { title: '图书表格' ,requireAuth: true}
                },
                {
                    path: '/movie_table',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/CakeTable.vue'),
                    meta: { title: '电影表格' ,requireAuth: true}
                },
                {
                    path: '/music_table',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/PuddingTable.vue'),
                    meta: { title: '音乐表格' ,requireAuth: true}
                },
                {
                    // 富文本编辑器组件
                    path: '/editor',
                    component: () => import(/* webpackChunkName: "editor" */ '../components/page/VueEditor.vue'),
                    meta: { title: '富文本编辑器' }
                },
                {
                    // markdown组件
                    path: '/markdown',
                    component: () => import(/* webpackChunkName: "markdown" */ '../components/page/Markdown.vue'),
                    meta: { title: 'markdown编辑器' }
                },
                {
                    // 图片上传组件
                    path: '/upload',
                    component: () => import(/* webpackChunkName: "upload" */ '../components/page/Upload.vue'),
                    meta: { title: '文件上传' }
                },
                {
                    // vue-schart组件
                    path: '/charts',
                    component: () => import(/* webpackChunkName: "chart" */ '../components/page/DataCharts.vue'),
                    meta: { title: '数据统计' }
                }
            ]
        },
        {
            path: '/404',
            component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
            meta: { title: '404' }
        },
        {
            path: '/403',
            component: () => import(/* webpackChunkName: "403" */ '../components/page/403.vue'),
            meta: {title: '403'}
        },
        {
            path: '/login',
            component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'),
            meta: { title: '登录' }
        },
        {
            path: '/judge',
            component: () => import(/* webpackChunkName: "judge" */ '../components/page/Judge.vue')
        },
        {
            path: '*',
            redirect: '/404'
        },
        // {
        //     path: '/',
        //     component: () => import(/* webpackChunkName: "home" */ '../components/page/Judge.vue'),
        //     meta: {auth: true}
        // },

    ]
});
